using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Iacym.Entities;

namespace Iacym.Repository.Mapping
{
    public class HISTORIAL_ESTADO_CIVILMap : EntityTypeConfiguration<HISTORIAL_ESTADO_CIVIL>
    {
        public HISTORIAL_ESTADO_CIVILMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("HISTORIAL_ESTADO_CIVIL");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.PersonaId).HasColumnName("PersonaId");
            this.Property(t => t.EstadoCivilId).HasColumnName("EstadoCivilId");

            // Relationships
            this.HasRequired(t => t.ESTADO_CIVIL)
                .WithMany(t => t.HISTORIAL_ESTADO_CIVIL)
                .HasForeignKey(d => d.EstadoCivilId);
            this.HasRequired(t => t.PERSONA)
                .WithMany(t => t.HISTORIAL_ESTADO_CIVIL)
                .HasForeignKey(d => d.PersonaId)
                .WillCascadeOnDelete(false);

        }
    }
}
